import { generalRequest } from "~/services/genServ";
import {
  type DataResponse,
  type OtherItem,
} from "~/models/general";
//获取学生列表分页数据后台数据请求方法
export async function getOtherPageData(
  numName: String | null,
  currentPage: number
): Promise<DataResponse> {
  const res = await generalRequest("/api/other/getOtherPageData", {
    numName: numName,
    currentPage: currentPage,
  });
  return res as DataResponse;
}
//删除学生后台数据请求方法
export async function otherDelete(otherId: number): Promise<DataResponse> {
  const res = await generalRequest("/api/other/otherDelete", {
    otherId: otherId,
  });
  return res as DataResponse;
}
//获取学生基本信息后台数据请求方法
export async function getOtherInfo(otherId: number): Promise<OtherItem> {
  const res = await generalRequest("/api/other/getOtherInfo", {
    otherId: otherId,
  });
  return res.data as OtherItem;
}

export async function getOtherList(numName: String | null): Promise<[]> {
    const res = await generalRequest("/api/teacher/getOtherList", {
      numName: numName,
    });
    return res as [];
  }
//保存学生基本信息后台数据请求方法
export async function otherEditSave(
  otherId: number | null,
  form: OtherItem
): Promise<DataResponse> {
  const res = await generalRequest("/api/other/otherEditSave", {
    otherId: otherId,
    form: form,
  });
  return res as DataResponse;
}
